//
//  Layout.h
// 
//

#import <Foundation/Foundation.h>

static inline CGFloat topOf(UIView *view) {
    return view.frame.origin.y;
};
static inline CGFloat bottomOf(UIView *view) {
    return view.frame.origin.y + view.frame.size.height;
};
static inline CGFloat ycenterOf(UIView *view) {
    return view.frame.origin.y + floor(view.frame.size.height / 2.0);
};

static inline CGFloat leftOf(UIView *view) {
    return view.frame.origin.x;
};
static inline CGFloat rightOf(UIView *view) {
    return view.frame.origin.x + view.frame.size.width;
};
static inline CGFloat xcenterOf(UIView *view) {
    return view.frame.origin.x + floor(view.frame.size.width / 2.0);
};

static inline CGFloat heightOf(UIView *view) {
    return view.frame.size.height;
};
static inline CGFloat widthOf(UIView *view) {
    return view.frame.size.width;
};

static inline CGRect moveRelative(UIView *view, CGFloat dx, CGFloat dy) {
    return CGRectMake(view.frame.origin.x + dx,
                      view.frame.origin.y + dy,
                      view.frame.size.width,
                      view.frame.size.height);
};